by Gehan Fernando (47 Submissions)
Category: Miscellaneous
Compatability: VB.NET
Difficulty: Unknown Difficulty
Originally Published: Wed 11th October 2006
Date Added: Mon 8th February 2021
Rating: (1 Votes)
VB.NET - Easy Way To Add Data Into DataGridView Without Using [List Or Any Other Objects ]
API Declarations
Private ColName As New DataGridViewTextBoxColumn()
Private ColAmount As New DataGridViewTextBoxColumn()
Grid1.Columns.Clear()
Grid1.AutoGenerateColumns = False
ColID.HeaderText = "Security Code"
ColID.ReadOnly = True
ColID.Width = 100
Grid1.Columns.Add(ColID)
ColName.HeaderText = "Name"
ColName.ReadOnly = True
ColName.Width = 250
Grid1.Columns.Add(ColName)
ColAmount.HeaderText = "Amount"
ColAmount.ReadOnly = True
ColAmount.Width = 250
Grid1.Columns.Add(ColAmount)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Call FormatGrid()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Grid1.Rows.Add()
Dim RCount As Integer = Grid1.Rows.Count
Grid1.Rows.Item(RCount - 1).Cells(0).Value = TextBox1.Text
Grid1.Rows.Item(RCount - 1).Cells(1).Value = TextBox2.Text
Grid1.Rows.Item(RCount - 1).Cells(2).Value = TextBox3.Text
End Sub
No comments have been posted about VB.NET - Easy Way To Add Data Into DataGridView Without Using [List Or Any Other Objects ]. Why not be the first to post a comment about VB.NET - Easy Way To Add Data Into DataGridView Without Using [List Or Any Other Objects ].